<template>
	<view class="weaper">
	    <view class="wdapge">
	        <view class="searchdvaaa">
	            <input type="text" class="inppd" 
	             v-model="keywords" placeholder="请输入名称"   />
	            <view class="searchbt" @click="click_search" >查询</view>
	        </view>
	        <view >
	            <view class="frmand" v-for="item in datalist">
	                <view class="itemna">经销商编号：{{item.user_code}}</view>
	                <view class="itemna">经销商名称：{{item.username}}</view>
	                <view class="itemna" v-if="item.role == 1">经销商类型：省代</view>
					<view class="itemna" v-if="item.role == 2">经销商类型：经销商</view>
					<view class="itemna" v-if="item.role == 3">经销商类型：分销商</view>
					<view class="itemna" v-if="item.role == 4">经销商类型：门店</view>
					<view class="danghang" @click="get_to_map(item)" v-if="item.role == 4">导航</view>
	            </view>
	            <view class="nodata" v-if="datalist.length == 0">暂无网点信息</view>
	        </view>
	    </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
			  page:1,
			  size:10,
			  keywords:"",
			  netcode:"",
			  tabindex:1,
			  wd_code:"",
			  datalist:[],
			  dataall:[]
			}
		},
		onShow() {
			this.get_data()
		},
		methods: {
			get_to_map(item){
				uni.openLocation({
					longitude: parseFloat(item.longitude),
					latitude: parseFloat(item.latitude),
					scale: 28, // 缩放比例TODO
					name:item.username,//地点名称
					address:item.detail,//地点详细地址
					success: function (res) {
						console.log('success:',res);
					}
				});
			},
			get_data(){
				var that=this
				var postdata={}
				postdata.keywords=this.keywords
				postdata.user_id=uni.getStorageSync("fahuo_username").id
				this.request('/api/duoqudao/wdstore_list', postdata,"post").then(data => {
					console.log('data',data)
					
					that.datalist=data.data
				})
			},
			click_search(){
				this.datalist=[];
				this.get_data()
			}
		}
	}
</script>

<style>
.weaper{
  width: 100%;
  margin: 0 auto;
  padding-bottom: 100px;
}
.danghang{
	text-align: right;
	color: #000;
}
.uplist{
  height: 45px;
  line-height: 45px;
  display:flex;
  background-color: #fff;
  margin-bottom: 10px;
}
.active{
  background-color: #00BFBF;
  height: 3px;
  width: 30px;
  position:absolute;
  left: 42%;
  top: 43px;
}
.searchdvaaa{
  display: flex;
  margin-top: 24px;
  height: 40px;
  line-height: 40px;
}
.searchbt{
  width: 80px;
  text-align: center;
  background: #fff;
  border-radius: 0px 40px 40px 0px;
  margin-top: 1px;
  height: 40px;
}
.inppd{
  height: 40px;
  line-height: 40px;
  border:  1px solid #eee;
  font-size: 14px;
  border-radius: 20px 0px 0px 20px;
  padding-left: 10px;
  background-color: #fff;
  width: calc(100% - 40px);
}
.deletebtn{
  color: rgb(97, 93, 93);
  text-align: right;
  padding: 10px 0px 0px 0px;
}
.wdapge{
  width: calc(100% - 40px);
  margin: 0 auto;
  padding-bottom: 100px;
}
.itemsaa{
  width: 50%;
  text-align: center;
  position:relative;
}
.frmand{
  font-size: 14px;
  margin-top: 8px;
  background-color: #fff;
  padding: 10px;
  border-radius: 5px;
}
.shuyuan{
  text-align: center;
  background-color: #1B764A;
  color: #fff;
  height: 35px;
  line-height: 35px;
  border-radius: 5px;
  margin-top: 20px;
}
.navtitle{
  margin-top: 20px;
}
.itemna{
  line-height: 28px;
  color: #666;
}
page{
  background-color: #eee;
}
.serarchite{
  display: flex;
}
.inputser{
  font-size: 16px;
  height: 32px;
  line-height: 32px;
  border: 1px solid #eee;
  border-radius: 5px;
  padding-left: 10px;
}
.serarchite{
  margin: 10px 0px;
}
.title{
  font-size: 14px;
  width: 60px;
  line-height: 34px;
}
.searchbtn{
  height: 32px;
  line-height: 32px;
  background-color: #1B764A;
  color: #fff;
  text-align: center;
  border-radius: 5px;
  width: 40%;
  margin: 0 auto;
  margin-top: 20px;
}
.butomsearch{
  background-color: #fff;
  padding: 10px;
  border-radius: 5px;
  margin-top: 10px;
}
.nodata{
  text-align: center;
  margin-top: 100px;
  color: #666;
  font-size: 14px;
}
.tad{
  border-top: 1px solid #eee;
  height: 35px;
  line-height: 35px;
  color: #333;
  border-bottom: 1px solid #eee;
}
</style>
